"""
函数定义
function
"""


def func1(name, city):
    print("name=%s,city=%s" % (name, city))


func1("zhangsan", "北京")
func1(name="zhangsan1", city="上海")


def func2(name, city="深圳"):
    print("name=%s,city=%s" % (name, city))


func2("zhangsan")

'''
函数参数组
1:元组参数组的形式,不定长度

'''


def func3(*args):
    print(type(args))
    print(args)


func3()
func3(1)
func3(1, 2, 3, 4)

'''
函数参数组
2:字典参数组
'''


def func4(**kwargs):
    print(kwargs)


func4()
func4(a=1)
func4(a=1, b=2)

'''
函数参数组
3:有返回值
'''


def add_num(a, b):
    return a + b


result = add_num(3, 4)
print(result)

'''
函数参数组
4:有返回值多个
'''


def show_num(a, b):
    return b, a


c, d = show_num(3, 4)
print(c, d)
'''
函数做为参数
4:有返回值多个
'''


def func_test(show_num):
    show_num(1, 2)
    print("success")


# 函数做为参数
func_test(show_num)
